<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>旋转2</title>
    <script type="text/javascript">
        function load () {
            let c = document.getElementById('myCanvas');
            let context = c.getContext('2d');

            // 把坐标轴移到(x, y)
            context.translate(200, 20);
            for (let i=1; i<80; i++) {
                context.translate(30, 30);
                context.scale(0.95, 0.95);
                context.rotate(Math.PI/12);

                context.beginPath();
                context.fillStyle='#ff0000';
                context.globalAlpha='0.4';
                // 顺时针
                context.arc(0, 0, 50, 0, Math.PI*2,true);
                context.closePath();
                context.fill();
            }
        }

        window.onload  = function () {
            load();
        }
    </script>
</head>
<body>
    <canvas id="myCanvas" style="border: 1px solid #000000" width="800" height="450">
        你的浏览器不支持canvas元素！
    </canvas>
</body>
</html>